/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.*;

/**
 * <p>Project: app2022 - Set3
 * <p>Powered by webrx On 2022-01-14 17:47:02
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Set3 {
    public static void main(String[] args) {
        Random rand = new Random();
        //red 6 1-33
        Set<Integer> red = new HashSet<>();
        while(red.size()<6){
            red.add(rand.nextInt(1,34));
        }
        //blue 1 1-16
        int blue = rand.nextInt(1,17);
        //System.out.println(red);
        //System.out.println(blue);

        List<List> list = new ArrayList<>();
        var list1 = new ArrayList<Integer>(red);
        Collections.sort(list1);

        var list2 = new ArrayList<Integer>(List.of(blue));

        list.add(list1);
        list.add(list2);
        System.out.println(list);

        //Set - List 相互转换
        List<Integer> a = new ArrayList<>(List.of(11,22,33,11,44,11,55,11,66,77,88));
        System.out.println(a);

        //List -> Set
        Set<Integer> b = new HashSet<>(a);
        System.out.println(b);

        //Set->List
        List<Integer> c = new ArrayList<>(b);
        c.addAll(List.of(11,11,11,222,33));
        System.out.println(c);
    }
}
